package pl.makimo.ksr.gui;

import javax.swing.JTextField;

import pl.makimo.fuzzy.sets.memberships.MembershipFunction;
import pl.makimo.fuzzy.sets.memberships.Type2TriangularIntervalMembershipFunction;

public class Type2TriangularGaussianMembershipFunctionCreator extends MembershipFunctionCreator {
	private JTextField field1 = new JTextField("a");
	private JTextField field2 = new JTextField("b");
	private JTextField field3 = new JTextField("c");
	private JTextField field4 = new JTextField("deviation");
	
	public Type2TriangularGaussianMembershipFunctionCreator() {
		super();
		parametersPane.add(field1);
		parametersPane.add(field2);
		parametersPane.add(field3);
		parametersPane.add(field4);
	}
	
	@Override
	public MembershipFunction getFunction() {
		double a = Double.parseDouble(field1.getText());
		double b = Double.parseDouble(field2.getText());
		double c = Double.parseDouble(field3.getText());
		double d = Double.parseDouble(field4.getText());
		
		return new Type2TriangularIntervalMembershipFunction(a, b, c, d);
	}
}
